﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;

using CloudSoft.Workflows;

namespace ERPStore.NewsLetters.Workflows.Activities
{
	public sealed class GetCampaign : CodeActivity
	{
		public InArgument<int> CampaignId { get; set; }
		public OutArgument<Models.Campaign> Campaign { get; set; }

		protected override void Execute(CodeActivityContext context)
		{
			int id = context.GetValue(this.CampaignId);
			var svc = context.GetService<ERPStore.NewsLetters.Services.NewsLettersService>();
			var campaign = svc.GetCampaignById(id);
			context.SetValue(this.Campaign, campaign);
		}
	}
}
